<?php

include 'include/config.php';

if ($_POST['user'] != '') {

    $sql = "Select * from users where user='" . addslashes($_POST['user']) ."' and passwd=md5('" . addslashes($_POST['passwd']) . "');";    
    
    $res = mysql_query($sql) or die("asdasd"); 

    if (mysql_num_rows($res) == '1') {

        $user = mysql_fetch_array($res);
	$_SESSION['_id'] = $user['id'];
        $_SESSION['_user'] = $user['user'];
        $_SESSION['_level'] = $user['level'];
        header("location: index.php");
    } else {
	header("location: login.php");
    }
}

include "include/head.php";

?>
<div id="container">
<div id="menu"><div><div>
<ul>
 <li></li>
</ul>
</div></div></div>

<div id="submenu"><div><div>

</div></div></div>
<div id="content"><div id="mid">
<form name="form1" method="post" action="">
<h2>AUTENTIFICARE USER</h2>
    <label>USER</label><input name="user" type="text" class="tf bb"  /><br class="clear" />
    <label>PAROLA</label><input name="passwd" type="password" class="tf bb" /><br class="clear" />
    <label>&nbsp;</label>
    <input name="login" type="submit" value="Login" class="ok" />
</form>
</div>
</div>
</div>
<?

include "include/footer.php";

?>